package com.winchain.provider.expiration.rx;

import com.shell.framework.command.ChainBase;
import com.shell.framework.command.CommandContext;
import com.winchain.provider.expiration.cmd.BillExpCreditExeCmd;
import com.winchain.provider.expiration.cmd.BillExpCreditMsgCmd;
import com.winchain.provider.expiration.cmd.BillExpDlyInsMsgCmd;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BillExpCreditSubscriber extends TransactionStandaloneSubscriber<BillExpirationEvent> {
	@Autowired
	private BillExpCreditExeCmd billExpCreditExeCmd;
	@Autowired
	private BillExpCreditMsgCmd billExpCreditMsgCmd;
	@Autowired
	private BillExpDlyInsMsgCmd billExpDlyInsMsgCmd;

	public void execute(BillExpirationEvent t) {
		CommandContext<BillExpirationEvent> context = new CommandContext();
		context.setSource(t);

		ChainBase<BillExpirationEvent> crb = new ChainBase();
		crb.add(this.billExpCreditExeCmd);
		crb.add(this.billExpCreditMsgCmd);
		crb.add(this.billExpDlyInsMsgCmd);
		crb.execute(context);
	}
}
